home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / graphics / 3dvect30.arj / OBJECTS.INC < prev    next >
Text File  |  1993-11-18  |  28KB  |  720 lines

  1. ;          include knight.inc
  2.  
  3. setupbase:
  4.  
  5.            mov objbase[0*4],offset headercube4
  6.            mov objbase[1*4],offset headercube2
  7.            mov objbase[2*4],offset headerring
  8.            mov objbase[3*4],offset headerdiamond
  9.            mov objbase[4*4],offset headerrubine
  10.            mov objbase[5*4],offset headercube3
  11.            mov objbase[6*4],offset headercube4
  12.  
  13. ;          mov objbase[0*4],offset headerknight
  14.  
  15.            mov esi,0               ; from object #
  16.            mov edi,6               ; to object #
  17.            call set_up_all_lambert ; find and set up shading tables
  18.  
  19.            ret
  20.  
  21. ; shape data can be almost as large as you need it 'till it crashes. try a cube
  22. ; 20000x20000x20000.    calculations  use  32  bit  registers  and  can  handle
  23. ; up to 16 bit locations.  keeping the object size small will  allow  a  larger
  24. ; visible space.  but larger objects will allow you to get  closer  with   more
  25. ; accuracy in the mathematics of rotations.  remember, if you make a really big
  26. ; object, set minz to the largest object on the screen so the large object wont
  27. ; mess up when you get really close to it.
  28. ;
  29. ; format for objects:
  30. ;
  31. ; thing:
  32. ; dw xx         ; number of points
  33. ; dw yy         ; number of surfaces
  34. ; dw 25 dup (?) ; 25 future use words
  35. ;
  36. ; dw xx,yy,zz   ; x,y,z of point 0
  37. ; dw xx,yy,zz   ; x,y,z of point 1
  38. ; dw xx,yy,zz   ; x,y,z of point 2
  39. ; ...
  40. ;
  41. ; dw command
  42. ; dw texture for side 1
  43. ; dw texture for side 2
  44. ; dw colour for side 1
  45. ; dw colour for side 2
  46. ; dw connection data eg (1,2,3,4,1)
  47. ; dw [?,?,?] [optional surface normal if command 128 used]
  48. ; dw more connection data...
  49. ;
  50. ; to re-cap: dw command,texture1,texture2,colour1,colour2,connection,[0,0,0]
  51. ;
  52. ; list of command bits to date: (options grouped by function:)
  53. ;
  54. ; note: "visible" = "points appear counter-clockwise"
  55. ;
  56. ; texture definitions:
  57. ;
  58. ;   0       - normal surface, no features, constant colour.
  59. ;   wavey   - steel texture for surface 0 = none,  colour  offset  determines
  60. ;             screen offset for texture.  eg 16+7 will use colour block 16-31
  61. ;             but make the sine wave texture 14 (7*2) lines down. this is  so
  62. ;             all sine wave textures do not appear on the same line.
  63. ;             windows and engines look good with this feature.
  64. ;   shade   - lambert shading bit, must have normal calculated or  at  least
  65. ;             have    free    space     for    pre_cal_lambert    to    use:
  66. ;             eg x,x,x,x,x,1,2,3,1,?,?,?<- these 3 words are surface normal!
  67. ;   inverse - inversion bit for shading option.  0=normal shading, 1=inverse
  68. ;             inversion automatically occures when other side is displayed.
  69. ;   glow    - =shade+inverse
  70. ;   last    - colour has same colour as previous surface (used when
  71. ;             you want gourad shading, but want to avoid  duplicate
  72. ;             calculations - don't set gourad bit if this  is  what
  73. ;             you use it for.) when this is used, the colour number
  74. ;             determines the new colour block to use.  the  shading
  75. ;             of this colour will be the same as the surface before
  76. ;             it, but the colour block can be different.
  77. ;
  78. ; commands:
  79. ;
  80. ;   point   - defines a single point; must be repeated! eg dw 64,col,3,3
  81. ;   line    - if used, defines a line (must be set to define a true line)
  82. ;   himap   - if set, defines a bitmap,eg: point #, bitmap #, x scale,y scale
  83. ;   lomap   - uses 1/4 scaled bitmap (every 4'th pixel is sampled), fast
  84. ;
  85. ;   iterate - generate iteration if side visible (iteration = sub-object)
  86. ;   matrix  - modify matrix when generating iteration.  matrix object
  87. ;             offset is 3rd word (6'th byte) in future use words.
  88. ;
  89. ;   both    - side is always visible no matter angle, skips counter-clowise test
  90. ;           - "both sides have same texture"
  91. ;   double  - side is always visible but other side has other colour
  92. ;             "double sided surface"
  93. ;             note: if this is used, option "both" must not be used!!
  94. ;   onscr   - test if side is on screen - don't use if all points are
  95. ;             outside clipping parameters.
  96. ;   check   - dont plot this side, just use as test points for visibility.
  97. ;             this is mostly used with iterations.
  98. ;
  99. ; there are two kinds of bitmaps and points.  those which  are  inside  objects
  100. ; and those which are seperate objects themselves. if userotate object  command
  101. ; is set to 32 or 64, then the entire object is considered to be either a point
  102. ; or bitmap.  but if userotate is not set this way, then  a  normal  object  is
  103. ; drawn and bitmaps then come from within the object definitions (below).  this
  104. ; way, bitmaps and points can be either part of a larger object,  or  they  are
  105. ; computed fast on their own. (eg explosions and bullets as  seperate  objects)
  106. ;
  107. ; note: when writing surface descriptions, try to make the  first value unique
  108. ; from any other first value.  this way, the sort routine  will  give  a  more
  109. ; accurate sorting of sides. eg 1,3,6,1  2,4,1,2  rather than 1,3,6,1  1,2,4,1
  110. ;
  111. ; to recap:
  112. ;
  113. ;        0 = constant colour, only visible from counter-clockwise side
  114. ;    wavey = sine texture
  115. ;    shade = shading - requires 3 blank words for surface normal eg dw 0,0,0
  116. ;  inverse = invert the shading direction, 0=normal, 1=sun is other way.
  117. ;     last = use intensity from previous surface (not colour, only intensity)
  118. ;
  119. ;    point = point
  120. ;     line = line
  121. ;    himap = bitmap (scalable, non-rotatable)
  122. ;    lomap = bitmap (scalable, non-rotatable)
  123. ;  iterate = generate iteration if side visible
  124. ;     both = always visible
  125. ;   double = always visible but other side has high byte colour,"double sided"
  126. ;    onscr = plot side only if all the following points are on the screen
  127. ;    check = dont plot side but use the following points as a test for visiblity
  128. ;
  129. ; what you can't mix on a single surface: "double" with "both"!!
  130. ;
  131. ; you do not have to define a point for the center of the  object.  the  point
  132. ; 0 defines the center of the object.  this is different from earlier versions
  133. ;
  134.            align 16
  135.  
  136. headercube1 dd -1
  137.             dd offset cube1a - offset $ - 4
  138.  
  139. cube1a     dw 8           ; how many points
  140.            dw 6           ; how many surfaces
  141.            dw 25 dup (?)  ; future use
  142.            ;    x   y   z
  143.            dw -70, 70, 70 ;1
  144.            dw -70,-70, 70 ;2
  145.            dw  70,-70, 70 ;3
  146.            dw  70, 70, 70 ;4
  147.            dw -70, 70,-70 ;5
  148.            dw -70,-70,-70 ;6
  149.            dw  70,-70,-70 ;7
  150.            dw  70, 70,-70 ;8
  151.  
  152.            dw 0,?,?,16*9+12 ,? ,1,2,3,4,1 ; surface connection data, and colours
  153.            dw 0,wavey,?,16*7+6  ,? ,8,7,6,5,8 ; end point=start point means done side
  154.            dw 0,wavey,?,16*3+9  ,? ,4,3,7,8,4
  155.            dw 0,shade,?,16*5+0  ,? ,5,6,2,1,5  ,?,?,? ;<-- lambert shading
  156.           dw 0,shade,?,16*2+0  ,? ,5,1,4,8,5  ,?,?,? ;<-- normal gets shoved
  157.            dw 0,shade,?,16*11+0 ,? ,2,6,7,3,2  ,?,?,? ;<-- here, leave blank
  158. ;
  159.  
  160. headercube2 dd -1
  161.             dd offset cube2a - offset $ - 4
  162.  
  163. cube2a     dw 8           ; how many points
  164.            dw 9           ; how many surfaces
  165.            dw 25 dup (?)
  166.            ;    x   y   z
  167.            dw -70, 70, 70 ;1
  168.            dw -70,-70, 70 ;2
  169.            dw  70,-70, 70 ;3
  170.            dw  70, 70, 70 ;4
  171.            dw -70, 70,-70 ;5
  172.            dw -70,-70,-70 ;6
  173.            dw  70,-70,-70 ;7
  174.            dw  70, 70,-70 ;8
  175.  
  176.            dw double,shade,wavey,16*3+0,16*5+8,1,2,3,4,1 ; command,txt1,txt2,col1,col2, surface connection data
  177.            dw ?,?,? ; surface normal goes here
  178.            dw 0,?,?,16*2+4 ,?,6,2,6   ; end point=start point means done side
  179.            dw 0,?,?,16*1+15,?,7,3,7   ; <-- these are lines
  180.            dw 0,?,?,16*2+12,?,8,4,8
  181.            dw 0,?,?,16*3+0 ,?,5,1,5
  182.            dw 0,?,?,16*4+10,?,6,7,6
  183.            dw 0,?,?,16*8+14,?,7,8,7
  184.            dw 0,?,?,16*7+13,?,8,5,8
  185.            dw 0,?,?,16*5+12,?,5,6,5
  186.  
  187. headercube3 dd 6000
  188.             dd offset cube3a - offset $ - 4
  189.             dd -1
  190.             dd offset cube3b - offset $ - 4
  191.  
  192. cube3a     dw 44          ; how many points
  193.            dw 45          ; how many surfaces
  194.            dw 25 dup (?)  ; future use
  195.            ;    x   y   z
  196.            dw -70, 70, 70 ;1
  197.            dw -70, 70, 35 ;2
  198.            dw -70, 70,  0 ;3
  199.            dw -70, 70,-35 ;4
  200.  
  201.            dw -70,-70, 70 ;5
  202.            dw -70,-70, 35 ;6
  203.            dw -70,-70,  0 ;7
  204.            dw -70,-70,-35 ;8
  205.  
  206.            dw  70,-70, 70 ;9
  207.            dw  70,-70, 35 ;10
  208.            dw  70,-70,  0 ;11
  209.            dw  70,-70,-35 ;12
  210.  
  211.            dw  70, 70, 70 ;13
  212.            dw  70, 70, 35 ;14
  213.            dw  70, 70,  0 ;15
  214.            dw  70, 70,-35 ;16
  215.  
  216.            dw -70, 70,-70 ;17
  217.            dw -70, 35,-70 ;18
  218.            dw -70,  0,-70 ;19
  219.            dw -70,-35,-70 ;20
  220.            dw -70,-70,-70 ;21
  221.  
  222.            dw  70, 70,-70 ;22
  223.            dw  70, 35,-70 ;23
  224.            dw  70,  0,-70 ;24
  225.            dw  70,-35,-70 ;25
  226.            dw  70,-70,-70 ;26
  227.  
  228.            dw -70, 35, 70 ;27
  229.            dw -70,  0, 70 ;28
  230.            dw -70,-35, 70 ;29
  231.  
  232.            dw  70, 35, 70 ;30
  233.            dw  70,  0, 70 ;31
  234.            dw  70,-35, 70 ;32
  235.  
  236.            dw -35,-70, 70 ;33
  237.            dw   0,-70, 70 ;34
  238.            dw  35,-70, 70 ;35
  239.  
  240.            dw -35,-70,-70 ;36
  241.            dw   0,-70,-70 ;37
  242.            dw  35,-70,-70 ;38
  243.  
  244.            dw -35, 70,-70 ;39
  245.            dw   0, 70,-70 ;40
  246.            dw  35, 70,-70 ;41
  247.  
  248.            dw -35, 70, 70 ;42
  249.            dw   0, 70, 70 ;43
  250.            dw  35, 70, 70 ;44
  251.  
  252.            dw himap,01,0,5,5 ; bitmaps have no future use bytes
  253.            dw himap,02,0,5,5
  254.            dw himap,03,0,5,5
  255.            dw himap,04,0,5,5
  256.            dw himap,05,0,5,5
  257.            dw himap,06,0,5,5
  258.            dw himap,07,0,5,5
  259.            dw himap,08,0,5,5
  260.            dw himap,09,0,5,5
  261.            dw himap,10,0,5,5
  262.            dw himap,11,0,5,5
  263.            dw himap,12,0,5,5
  264.            dw himap,13,0,5,5
  265.            dw himap,14,0,5,5
  266.            dw himap,15,0,5,5
  267.            dw himap,16,0,5,5
  268.            dw himap,17,0,5,5
  269.            dw himap,18,0,5,5
  270.            dw himap,19,0,5,5
  271.            dw himap,20,0,5,5
  272.            dw himap,21,0,5,5
  273.            dw himap,22,0,5,5
  274.            dw himap,23,0,5,5
  275.            dw himap,24,0,5,5
  276.            dw himap,25,0,5,5
  277.            dw himap,26,0,5,5
  278.            dw himap,27,0,5,5
  279.            dw himap,28,0,5,5
  280.            dw himap,29,0,5,5
  281.            dw himap,30,0,5,5
  282.            dw himap,31,0,5,5
  283.            dw himap,32,0,5,5
  284.            dw himap,33,0,5,5
  285.            dw himap,34,0,5,5
  286.            dw himap,35,0,5,5
  287.            dw himap,36,0,5,5
  288.            dw himap,37,0,5,5
  289.            dw himap,38,0,5,5
  290.            dw himap,39,0,5,5
  291.            dw himap,40,0,5,5
  292.            dw himap,41,0,5,5
  293.            dw himap,42,0,5,5
  294.            dw himap,43,0,5,5
  295.            dw himap,44,0,5,5
  296.  
  297.            dw himap,0,0,30,30
  298.  
  299. cube3b     dw 44  ; this is same as above but since bitmaps can't be seen
  300.            dw 45  ; from far, i use the same cube with points instead.
  301.            dw 25 dup (?)  ; future use
  302.            ;    x   y   z
  303.            dw -70, 70, 70 ;1  ; this is an example of how to use the
  304.            dw -70, 70, 35 ;2  ; different resolutions based on distance
  305.            dw -70, 70,  0 ;3  ; you could get rid of half of these points
  306.            dw -70, 70,-35 ;4  ; and still have it "look" the same because
  307.  
  308.            dw -70,-70, 70 ;5  ; of the great distance at which this will
  309.            dw -70,-70, 35 ;6  ; be seen
  310.            dw -70,-70,  0 ;7
  311.            dw -70,-70,-35 ;8
  312.  
  313.            dw  70,-70, 70 ;9
  314.            dw  70,-70, 35 ;10
  315.            dw  70,-70,  0 ;11
  316.            dw  70,-70,-35 ;12
  317.  
  318.            dw  70, 70, 70 ;13
  319.            dw  70, 70, 35 ;14
  320.            dw  70, 70,  0 ;15
  321.            dw  70, 70,-35 ;16
  322.  
  323.            dw -70, 70,-70 ;17
  324.            dw -70, 35,-70 ;18
  325.            dw -70,  0,-70 ;19
  326.            dw -70,-35,-70 ;20
  327.            dw -70,-70,-70 ;21
  328.  
  329.            dw  70, 70,-70 ;22
  330.            dw  70, 35,-70 ;23
  331.            dw  70,  0,-70 ;24
  332.            dw  70,-35,-70 ;25
  333.            dw  70,-70,-70 ;26
  334.  
  335.            dw -70, 35, 70 ;27
  336.            dw -70,  0, 70 ;28
  337.            dw -70,-35, 70 ;29
  338.  
  339.            dw  70, 35, 70 ;30
  340.            dw  70,  0, 70 ;31
  341.            dw  70,-35, 70 ;32
  342.  
  343.            dw -35,-70, 70 ;33
  344.            dw   0,-70, 70 ;34
  345.            dw  35,-70, 70 ;35
  346.  
  347.            dw -35,-70,-70 ;36
  348.            dw   0,-70,-70 ;37
  349.            dw  35,-70,-70 ;38
  350.  
  351.            dw -35, 70,-70 ;39
  352.            dw   0, 70,-70 ;40
  353.            dw  35, 70,-70 ;41
  354.  
  355.            dw -35, 70, 70 ;42
  356.            dw   0, 70, 70 ;43
  357.            dw  35, 70, 70 ;44
  358.  
  359.            dw 0,?,?,28,?, 01,01
  360.            dw 0,?,?,28,?, 02,02
  361.            dw 0,?,?,28,?, 03,03
  362.            dw 0,?,?,28,?, 04,04
  363.            dw 0,?,?,28,?, 05,05
  364.            dw 0,?,?,28,?, 06,06
  365.            dw 0,?,?,28,?, 07,07
  366.            dw 0,?,?,28,?, 08,08
  367.            dw 0,?,?,28,?, 09,09
  368.            dw 0,?,?,28,?, 10,10
  369.            dw 0,?,?,28,?, 11,11
  370.            dw 0,?,?,28,?, 12,12
  371.            dw 0,?,?,28,?, 13,13
  372.            dw 0,?,?,28,?, 14,14
  373.            dw 0,?,?,28,?, 15,15
  374.            dw 0,?,?,28,?, 16,16
  375.            dw 0,?,?,28,?, 17,17
  376.            dw 0,?,?,28,?, 18,18
  377.            dw 0,?,?,28,?, 19,19
  378.            dw 0,?,?,28,?, 20,20
  379.            dw 0,?,?,28,?, 21,21
  380.            dw 0,?,?,28,?, 22,22
  381.            dw 0,?,?,28,?, 23,23
  382.            dw 0,?,?,28,?, 24,24
  383.            dw 0,?,?,28,?, 25,25
  384.            dw 0,?,?,28,?, 26,26
  385.            dw 0,?,?,28,?, 27,27
  386.            dw 0,?,?,28,?, 28,28
  387.            dw 0,?,?,28,?, 29,29
  388.            dw 0,?,?,28,?, 30,30
  389.            dw 0,?,?,28,?, 31,31
  390.            dw 0,?,?,28,?, 32,32
  391.            dw 0,?,?,28,?, 33,33
  392.            dw 0,?,?,28,?, 34,34
  393.            dw 0,?,?,28,?, 35,35
  394.            dw 0,?,?,28,?, 36,36
  395.            dw 0,?,?,28,?, 37,37
  396.            dw 0,?,?,28,?, 38,38
  397.            dw 0,?,?,28,?, 39,39
  398.            dw 0,?,?,28,?, 40,40
  399.            dw 0,?,?,28,?, 41,41
  400.            dw 0,?,?,28,?, 42,42
  401.            dw 0,?,?,28,?, 43,43
  402.            dw 0,?,?,28,?, 44,44
  403.  
  404.            dw himap,0,0,30,30     ; 0 = center of object
  405.  
  406. headerring dd -1
  407.            dd offset ringa - offset $ - 4
  408.  
  409. ringa      dw 32
  410.            dw 32
  411.            dw 25 dup (?)  ; future use
  412.            ;    x   y   z
  413.            dw -40, 80, 30 ; 1
  414.            dw -80, 40, 30 ; 2
  415.            dw -80,-40, 30 ; 3
  416.            dw -40,-80, 30 ; 4
  417.            dw  40,-80, 30 ; 5
  418.            dw  80,-40, 30 ; 6
  419.            dw  80, 40, 30 ; 7
  420.            dw  40, 80, 30 ; 8
  421.            dw -40, 20, 45 ; 9
  422.            dw -40,-20, 45 ;10
  423.            dw -20,-40, 45 ;11
  424.            dw  20,-40, 45 ;12
  425.            dw  40,-20, 45 ;13
  426.            dw  40, 20, 45 ;14
  427.            dw  20, 40, 45 ;15
  428.            dw -20, 40, 45 ;16
  429.            dw -40, 80,-30 ;17
  430.            dw -80, 40,-30 ;18
  431.            dw -80,-40,-30 ;19
  432.            dw -40,-80,-30 ;20
  433.            dw  40,-80,-30 ;21
  434.            dw  80,-40,-30 ;22
  435.            dw  80, 40,-30 ;23
  436.            dw  40, 80,-30 ;24
  437.            dw -40, 20,-45 ;25
  438.            dw -40,-20,-45 ;26
  439.            dw -20,-40,-45 ;27
  440.            dw  20,-40,-45 ;28
  441.            dw  40,-20,-45 ;29
  442.            dw  40, 20,-45 ;30
  443.            dw  20, 40,-45 ;31
  444.            dw -20, 40,-45 ;32
  445.  
  446.            dw 0,shade,?,16*3+0,? ,2,9,16,1,2     ,?,?,? ; these  zeros   get   filled
  447.            dw 0,shade,?,16*3+0,? ,3,10,9,2,3     ,?,?,? ; with the calculated surface
  448.            dw 0,shade,?,16*3+0,? ,4,11,10,3,4    ,?,?,? ; normal.  we could calculate
  449.            dw 0,shade,?,16*3+0,? ,5,12,11,4,5    ,?,?,? ; them ourselves but god, too
  450.            dw 0,shade,?,16*3+0,? ,6,13,12,5,6    ,?,?,? ; much work.
  451.            dw 0,shade,?,16*3+0,? ,7,14,13,6,7    ,?,?,?
  452.            dw 0,shade,?,16*3+0,? ,8,15,14,7,8    ,?,?,? ; remember, if you remove  the
  453.            dw 0,shade,?,16*3+0,? ,1,16,15,8,1    ,?,?,? ; shading parameter (128) then
  454.            dw 0,shade,?,16*3+0,? ,1,17,18,2,1    ,?,?,? ; you must remove these 0's
  455.            dw 0,shade,?,16*3+0,? ,2,18,19,3,2    ,?,?,?
  456.            dw 0,shade,?,16*3+0,? ,3,19,20,4,3    ,?,?,?
  457.            dw 0,shade,?,16*3+0,? ,4,20,21,5,4    ,?,?,?
  458.            dw 0,shade,?,16*3+0,? ,5,21,22,6,5    ,?,?,?
  459.            dw 0,shade,?,16*3+0,? ,6,22,23,7,6    ,?,?,?
  460.            dw 0,shade,?,16*3+0,? ,7,23,24,8,7    ,?,?,?
  461.            dw 0,shade,?,16*3+0,? ,8,24,17,1,8    ,?,?,?
  462.            dw 0,shade,?,16*3+0,? ,10,26,25,9,10  ,?,?,?
  463.            dw 0,shade,?,16*3+0,? ,11,27,26,10,11 ,?,?,?
  464.            dw 0,shade,?,16*3+0,? ,12,28,27,11,12 ,?,?,?
  465.            dw 0,shade,?,16*3+0,? ,13,29,28,12,13 ,?,?,?
  466.            dw 0,shade,?,16*3+0,? ,14,30,29,13,14 ,?,?,?
  467.            dw 0,shade,?,16*3+0,? ,15,31,30,14,15 ,?,?,?
  468.            dw 0,shade,?,16*3+0,? ,15,16,32,31,15 ,?,?,?
  469.            dw 0,shade,?,16*3+0,? ,32,16,9,25,32  ,?,?,?
  470.            dw 0,shade,?,16*3+0,? ,18,25,26,19,18 ,?,?,?
  471.            dw 0,shade,?,16*3+0,? ,19,26,27,20,19 ,?,?,?
  472.            dw 0,shade,?,16*3+0,? ,20,27,28,21,20 ,?,?,?
  473.            dw 0,shade,?,16*3+0,? ,21,28,29,22,21 ,?,?,?
  474.            dw 0,shade,?,16*3+0,? ,22,29,30,23,22 ,?,?,?
  475.            dw 0,shade,?,16*3+0,? ,23,30,31,24,23 ,?,?,?
  476.            dw 0,shade,?,16*3+0,? ,24,31,32,17,24 ,?,?,?
  477.            dw 0,shade,?,16*3+0,? ,17,32,25,18,17 ,?,?,?
  478.  
  479. headerdiamond dd -1
  480.               dd offset diamonda - offset $ - 4
  481.  
  482. diamonda   dw 13
  483.            dw 17
  484.            dw 25 dup (?)  ; future use
  485.  
  486.            dw -100,  50,   0
  487.            dw -100, -50,   0
  488.            dw  -50,-100,   0
  489.            dw   50,-100,   0
  490.            dw  100, -50,   0
  491.            dw  100,  50,   0
  492.            dw   50, 100,   0
  493.            dw  -50, 100,   0
  494.            dw  -50,  50,  40
  495.            dw  -50, -50,  40
  496.            dw   50, -50,  40
  497.            dw   50,  50,  40
  498.            dw    0,   0,-120
  499.  
  500.            dw 0,shade,?,16*2+0,? ,1,2,10,9,1    ,?,?,?
  501.            dw 0,shade,?,16*2+0,? ,10,3,4,11,10  ,?,?,?
  502.            dw 0,shade,?,16*2+0,? ,12,11,5,6,12  ,?,?,?
  503.            dw 0,shade,?,16*2+0,? ,8,9,12,7,8    ,?,?,?
  504.            dw 0,shade,?,16*2+0,? ,2,3,10,2      ,?,?,?
  505.            dw 0,shade,?,16*2+0,? ,11,4,5,11     ,?,?,?
  506.            dw 0,shade,?,16*2+0,? ,7,12,6,7      ,?,?,?
  507.            dw 0,shade,?,16*2+0,? ,1,9,8,1       ,?,?,?
  508.            dw 0,shade,?,16*2+0,? ,9,10,11,12,9  ,?,?,?
  509.            dw 0,shade,?,16*2+0,? ,8,13,1,8      ,?,?,?
  510.            dw 0,shade,?,16*2+0,? ,1,13,2,1      ,?,?,?
  511.            dw 0,shade,?,16*2+0,? ,2,13,3,2      ,?,?,?
  512.            dw 0,shade,?,16*2+0,? ,3,13,4,3      ,?,?,?
  513.            dw 0,shade,?,16*2+0,? ,4,13,5,4      ,?,?,?
  514.            dw 0,shade,?,16*2+0,? ,5,13,6,5      ,?,?,?
  515.            dw 0,shade,?,16*2+0,? ,6,13,7,6      ,?,?,?
  516.            dw 0,shade,?,16*2+0,? ,7,13,8,7      ,?,?,?
  517.  
  518. headerrubine dd -1
  519.              dd offset rubinea - offset $ - 4
  520.  
  521. rubinea    dw 16
  522.            dw 18
  523.            dw 25 dup (?)  ; future use
  524.  
  525.            dw -100,  50,   0 ; 1
  526.            dw -100, -50,   0 ; 2
  527.            dw  -50,-100,   0 ; 3
  528.            dw   50,-100,   0 ; 4
  529.            dw  100, -50,   0 ; 5
  530.            dw  100,  50,   0 ; 6
  531.            dw   50, 100,   0 ; 7
  532.            dw  -50, 100,   0 ; 8
  533.            dw  -50,  50,  40 ; 9
  534.            dw  -50, -50,  40 ;10
  535.            dw   50, -50,  40 ;11
  536.            dw   50,  50,  40 ;12
  537.            dw  -50,  50, -40 ;13
  538.            dw  -50, -50, -40 ;14
  539.            dw   50, -50, -40 ;15
  540.            dw   50,  50, -40 ;16
  541.  
  542.            dw 0,shade,?,96+0,? ,1,2,10,9,1     ,?,?,?
  543.            dw 0,shade,?,96+0,? ,10,3,4,11,10   ,?,?,?
  544.            dw 0,shade,?,96+0,? ,12,11,5,6,12   ,?,?,?
  545.            dw 0,shade,?,96+0,? ,8,9,12,7,8     ,?,?,?
  546.            dw 0,shade,?,96+0,? ,2,3,10,2       ,?,?,?
  547.            dw 0,shade,?,96+0,? ,11,4,5,11      ,?,?,?
  548.            dw 0,shade,?,96+0,? ,7,12,6,7       ,?,?,?
  549.            dw 0,shade,?,96+0,? ,1,9,8,1        ,?,?,?
  550.            dw 0,shade,?,96+0,? ,9,10,11,12,9   ,?,?,?
  551.            dw 0,shade,?,96+0,? ,6,5,15,16,6    ,?,?,?
  552.            dw 0,shade,?,96+0,? ,15,4,3,14,15   ,?,?,?
  553.            dw 0,shade,?,96+0,? ,16,15,14,13,16 ,?,?,?
  554.            dw 0,shade,?,96+0,? ,13,14,2,1,13   ,?,?,?
  555.            dw 0,shade,?,96+0,? ,7,16,13,8,7    ,?,?,?
  556.            dw 0,shade,?,96+0,? ,5,4,15,5       ,?,?,?
  557.            dw 0,shade,?,96+0,? ,14,3,2,14      ,?,?,?
  558.            dw 0,shade,?,96+0,? ,8,13,1,8       ,?,?,?
  559.            dw 0,shade,?,96+0,? ,6,16,7,6       ,?,?,?
  560.  
  561. ; this  object  is  an  example   of   how   to   use   the   new   iterations.
  562. ; notice how  there  are  only   6 main  surfaces  and  then  5  sub  surfaces.
  563. ; if the main surface is not visible,then the sub surfaces are totally skipped.
  564. ; pre_cal_lambert calculates the code offsets in case side is not visible,  but
  565. ; I have provided a few to give you an example of what pre_cal_lambert will do.
  566.  
  567. ; this demonstrates only one level of iteration, you can have as  many
  568. ; levels as you want.  notice how sub iterations are written just like
  569. ; main objects.
  570.  
  571. ; concave surfaces work well when put inside iterations (saves cpu time), but
  572. ; convex surfaces don't work well. eg, insides  of  volcanos  are  great  for
  573. ; cutting cpu time, but exterior things like rooftop buildings must  be  done
  574. ; seperatly (hint - inlay the rooftop building below the edge of the roof and
  575. ; you can now have the building and all the stuff on the roof in a iteration)
  576.  
  577. ; iterations save MEGA cpu time!!!
  578.  
  579.            align 16
  580.  
  581. headercube4 dd -1                        ; -1=end flag (last resolution)
  582.             dd offset cube4a - offset $ - 4
  583.  
  584. cube4a     dw 8           ; how many points
  585.            dw 6           ; how many surfaces
  586.            dw 25 dup (?)  ; future use
  587.            ;    x   y   z
  588.            dw -70, 70, 70 ;1 ; the main cube (defines exterior for checking)
  589.            dw -70,-70, 70 ;2
  590.            dw  70,-70, 70 ;3
  591.            dw  70, 70, 70 ;4
  592.            dw -70, 70,-70 ;5
  593.            dw -70,-70,-70 ;6
  594.            dw  70,-70,-70 ;7
  595.            dw  70, 70,-70 ;8
  596.  
  597.            dw check+iterate,?,?,?,?,1,2,3,1 ; test main surface, dont plot, just check dot product
  598.  
  599.                dw 4 ; 4 extra points if visible    (for this iteration, doesn't
  600.                dw 5 ; 5 extra surfaces if visible  (include iterations of iterations)
  601.  
  602.                dw ? ; reserved for offset of new startup location if failure - directs code to next valid surface
  603.                dw ? ; reserved for TOTAL number of points to skip if failure - ends up as 4, number of points within iteration
  604.  
  605.                dw 23 dup (?) ; for future use
  606.  
  607.                ;    x   y   z
  608.                dw -45, 45, 70 ; 9
  609.                dw -45,-45, 70 ;10
  610.                dw  45,-45, 70 ;11
  611.                dw  45, 45, 70 ;12
  612.  
  613.                ; these sides are always visible (+2) because the above  check
  614.                ; confirmed the dot product.  setting +2 option saves time for
  615.                ; checking each surface because the main surface was  visible.
  616.                ; this saves 2 imuls per surface. eg: check the  main  surface
  617.                ; for visibility and all sub surfaces must also be visible.
  618.  
  619.                dw both,glow ,?, 16*4+0,?,9,10,11,12,9, ?,?,? ; +256 is inverse gouraud shading, what the heck, lets get creative...
  620.                dw both,shade,?, 16*3+0,?,1,2,10,9,1  ,?,?,?
  621.                dw both,last ,?, 16*3+0,?,2,3,11,10,2        ; last = use previous colour (uses gourad)
  622.                dw both,last ,?, 16*3+0,?,3,4,12,11,3        ; previous surface must always
  623.                dw both,last ,?, 16*3+0,?,4,1,9,12,4         ; be visible if this is used
  624.  
  625.            dw check+iterate,?,?,?,? ,8,7,6,8 ; testing visibility only requires a triangle, not whole surface
  626.  
  627.                dw 4 ; same as above but different points used...
  628.                dw 5
  629.  
  630.                dw 25 dup (?)
  631.  
  632.                ;    x   y   z
  633.                dw -45, 45,-70 ;13
  634.                dw -45,-45,-70 ;14
  635.                dw  45,-45,-70 ;15
  636.                dw  45, 45,-70 ;16
  637.  
  638.                dw both,glow ,?,16*2+0,?,13,16,15,14,13, ?,?,?
  639.                dw both,shade,?,16*7+0,?,5,13,14,6,5   , ?,?,?
  640.                dw both,last ,?,16*7+0,?,6,14,15,7,6
  641.                dw both,last ,?,16*7+0,?,7,15,16,8,7
  642.                dw both,last ,?,16*7+0,?,8,16,13,5,8
  643.  
  644.            dw check+iterate+onscr,?,?,?,? ,4,3,7,4
  645.  
  646.                dw 4 ; concave side, notice how I use the commands below because
  647.                dw 5 ; we know this side is concave.
  648.  
  649.                dw 25 dup (?)
  650.  
  651.                ;    x   y   z
  652.                dw  30, 45, 45 ;17 - make x=70 and plane will be flat
  653.                dw  30,-45, 45 ;18
  654.                dw  30,-45,-45 ;19
  655.                dw  30, 45,-45 ;20
  656.  
  657.                dw both,shade,?,16*6+0,? ,17,18,19,20,17, ?,?,?
  658.                dw 0,   shade,?,16*9+0,? ,4,3,18,17,4,  ?,?,? ; <-commands here, i have removed
  659.                dw 0,   shade,?,16*9+0,? ,3,7,19,18,3,  ?,?,? ; the +2, 'cause these sides are not
  660.                dw 0,   shade,?,16*9+0,? ,8,20,19,7,8,  ?,?,? ; on the same plane as the original
  661.                dw 0,   shade,?,16*9+0,? ,8,4,17,20,8,  ?,?,? ; iteration check
  662.  
  663.            dw check+iterate,?,?,?,? ,5,6,2,5
  664.  
  665.                dw 4 ; another concave side
  666.                dw 5
  667.  
  668.                dw 25 dup (?)
  669.  
  670.                ;    x   y   z
  671.                dw -30, 45, 45 ;21 ; points are accumulated from original.
  672.                dw -30,-45, 45 ;22 ; eg: <-this point will always be point #22
  673.                dw -30,-45,-45 ;23 ; regardless of whether the above iterations
  674.                dw -30, 45,-45 ;24 ; were processed.
  675.  
  676.                dw both,shade,?, 16* 2+0,?,21,24,23,22,21, ?,?,?
  677.                dw 0   ,shade,?, 16*11+0,?,1,21,22,2,1,  ?,?,?
  678.                dw 0   ,shade,?, 16*11+0,?,5,24,21,1,5,  ?,?,?
  679.                dw 0   ,shade,?, 16*11+0,?,6,23,24,5,6,  ?,?,?
  680.                dw 0   ,shade,?, 16*11+0,?,6,2,22,23,6,  ?,?,?
  681.  
  682.           dw check+iterate,?,?,?,? ,5,1,4,5
  683.  
  684.                dw 4
  685.                dw 5
  686.  
  687.                dw 25 dup (?)
  688.  
  689.                ;    x   y   z
  690.                dw -45, 70,-45 ;25
  691.                dw -45, 70, 45 ;26
  692.                dw  45, 70, 45 ;27
  693.                dw  45, 70,-45 ;28
  694.  
  695.                dw both,glow    ,?, 16*2+0,?,25,26,27,28,25, ?,?,?
  696.                dw both,shade   ,?, 16*3+0,?,5,1,26,25,5,    ?,?,?
  697.                dw both,last    ,?, 16*3+0,?,1,4,27,26,1
  698.                dw both,last    ,?, 16*3+0,?,4,8,28,27,4
  699.                dw both,last    ,?, 16*3+0,?,8,5,25,28,8
  700.  
  701.            dw check+iterate,?,?,?,? ,2,6,7,2
  702.  
  703.                dw 4
  704.                dw 5
  705.  
  706.                dw 25 dup (?)
  707.  
  708.                ;    x   y   z
  709.                dw -45,-70,-45 ;29
  710.                dw -45,-70, 45 ;30
  711.                dw  45,-70, 45 ;31
  712.                dw  45,-70,-45 ;32
  713.  
  714.                dw both,glow ,?,16*5 +0,?,29,32,31,30,29, ?,?,?
  715.                dw both,shade,?,16*13+0,?,6,29,30,2,6,    ?,?,?
  716.                dw both,last ,?,16*13+0,?,2,30,31,3,2
  717.                dw both,last ,?,16*13+0,?,3,31,32,7,3
  718.                dw both,last ,?,16*13+0,?,7,32,29,6,7
  719.  
  720.